﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/activity.Master" AutoEventWireup="true" CodeBehind="updateactivity.aspx.cs" Inherits="pcsse.activity.updateactivity"  %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="hoder_sidebar" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="hoder_maincontent" runat="server">
    <div class="p_title">
活动管理
</div>
    <asp:GridView ID="mainGv" runat="server" AllowPaging="True" AllowSorting="True" 
    AutoGenerateColumns="False" DataSourceID="mGvOds" DataKeyNames="ID" 
        onrowdatabound="mainGv_RowDataBound">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="NAME" HeaderText="活动名称" SortExpression="NAME">
                <ItemStyle Width="120px" />
            </asp:BoundField>
            <asp:BoundField DataField="TIME" HeaderText="活动时间" 
            SortExpression="TIME" DataFormatString="{0:d}">
                <ItemStyle Width="80px" />
            </asp:BoundField>
            <asp:BoundField DataField="BUDGET" HeaderText="活动预算" SortExpression="BUDGET" 
                DataFormatString="{0:C}">
                <ItemStyle Width="80px" />
            </asp:BoundField>
            <asp:BoundField DataField="SUGGESTION" HeaderText="学院意见" 
            SortExpression="SUGGESTION">
                <ItemStyle Width="120px" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="状态" SortExpression="STATE">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("STATE") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="stateLb" runat="server" Text='<%# Bind("STATE") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="60px" />
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            没有申请活动记录
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:DetailsView ID="activityDv" runat="server" AutoGenerateRows="False" 
        DataSourceID="activityDvOds" DefaultMode="Edit" Height="50px" 
        Width="500px" DataKeyNames="ID" ondatabound="activityDv_DataBound" 
        onitemupdated="activityDv_ItemUpdated" 
        onitemupdating="activityDv_ItemUpdating">
        <FieldHeaderStyle Width="100px" />
        <Fields>
            <asp:TemplateField HeaderText="支部名" SortExpression="BRANCH_ID">
                <EditItemTemplate>
                    <asp:Label ID="Label15" runat="server" Text='<%# Eval("FULLNAME") %>'></asp:Label>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("BRANCH_ID") %>' 
                        Visible="False"></asp:Label>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="bDdl" runat="server" DataSourceID="branchOds" 
                        DataTextField="FULLNAME" DataValueField="ID" Height="20px" 
                        SelectedValue='<%# Bind("BRANCH_ID") %>' Width="150px">
                    </asp:DropDownList>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("BRANCH_ID") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="负责人" SortExpression="PRINCIPLE">
                <EditItemTemplate>
                    <asp:Label ID="Label8" runat="server" Text='<%# Eval("PRINCIPLE") %>'></asp:Label>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Height="20px" 
                        Text='<%# Bind("PRINCIPLE") %>' Width="80px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label8" runat="server" Text='<%# Bind("PRINCIPLE") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="联系方式" SortExpression="TELEPHONE">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("TELEPHONE") %>' 
                        Height="20px" Width="120px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                        ControlToValidate="TextBox7" ErrorMessage="联系方式格式错误" 
                        ValidationExpression="(\d{11})|(\(\d{3}\)|\d{3}-)?\d{8}"></asp:RegularExpressionValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox7" runat="server" Height="20px" 
                        Text='<%# Bind("TELEPHONE") %>' Width="120px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label9" runat="server" Text='<%# Bind("TELEPHONE") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="电子邮件" SortExpression="EMAIL">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox14" runat="server" Text='<%# Bind("EMAIL") %>' 
                        Height="20px" Width="200px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                        ControlToValidate="TextBox14" ErrorMessage="电子邮件格式不正确" 
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox14" runat="server" Height="20px" 
                        Text='<%# Bind("EMAIL") %>' Width="120px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label10" runat="server" Text='<%# Bind("EMAIL") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="活动名称" SortExpression="NAME">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox15" runat="server" Text='<%# Bind("NAME") %>' 
                        Height="20px" Width="150px"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox15" runat="server" Height="20px" 
                        Text='<%# Bind("NAME") %>' Width="150px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label11" runat="server" Text='<%# Bind("NAME") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="活动时间" SortExpression="TIME">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox16" runat="server" Text='<%# Bind("TIME", "{0:d}") %>' 
                        Height="20px" Width="120px" onfocus="calendar()"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox16" runat="server" Height="20px" 
                        Text='<%# Bind("TIME", "{0:d}") %>' Width="120px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("TIME", "{0:d}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="活动地点" SortExpression="PLACE">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox17" runat="server" Text='<%# Bind("PLACE") %>' 
                        Height="40px" TextMode="MultiLine" Width="180px"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox17" runat="server" Height="40px" 
                        Text='<%# Bind("PLACE") %>' TextMode="MultiLine" Width="180px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("PLACE") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="活动意义" SortExpression="SIGNIFICANCE">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox18" runat="server" Text='<%# Bind("SIGNIFICANCE") %>' 
                        Height="40px" TextMode="MultiLine" Width="180px"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox18" runat="server" Height="40px" 
                        Text='<%# Bind("SIGNIFICANCE") %>' TextMode="MultiLine" Width="180px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("SIGNIFICANCE") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="活动内容" SortExpression="CONTENT">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox19" runat="server" Text='<%# Bind("CONTENT") %>' 
                        Height="80px" TextMode="MultiLine" Width="180px"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox19" runat="server" Height="80px" 
                        Text='<%# Bind("CONTENT") %>' TextMode="MultiLine" Width="180px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("CONTENT") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="内容附件" SortExpression="ATTACHFILE">
                <EditItemTemplate>
                    <asp:TextBox ID="upFileTb" runat="server" Text='<%# Bind("ATTACHFILE") %>' 
                        Height="20px" ReadOnly="True" Width="150px"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="upFileTb" runat="server" Height="20px" ReadOnly="True" 
                        Text='<%# Bind("ATTACHFILE") %>' Width="150px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("ATTACHFILE") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <EditItemTemplate>
                    <asp:FileUpload ID="attachFu" runat="server" Font-Size="Small" Height="20px" />
                    <br />
                    <asp:LinkButton ID="upLoadBt" runat="server" onclick="upLoadBt_Click">上传附件</asp:LinkButton>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="预计成果" SortExpression="GOAL">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox22" runat="server" Text='<%# Bind("GOAL") %>' 
                        Height="40px" TextMode="MultiLine" Width="180px"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox22" runat="server" Height="40px" 
                        Text='<%# Bind("GOAL") %>' TextMode="MultiLine" Width="180px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label7" runat="server" Text='<%# Bind("GOAL") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="经费预算" SortExpression="BUDGET">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox23" runat="server" 
                        Text='<%# Bind("BUDGET", "{0:N2}") %>' Height="20px" Width="80px"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox23" runat="server" Height="20px" 
                        Text='<%# Bind("BUDGET") %>' Width="80px"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label12" runat="server" Text='<%# Bind("BUDGET") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="学院建议" SortExpression="SUGGESTION">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox24" runat="server" Height="60px" ReadOnly="True" 
                        Text='<%# Eval("SUGGESTION") %>' TextMode="MultiLine" Width="180px"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("SUGGESTION") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label13" runat="server" Text='<%# Bind("SUGGESTION") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="状态" SortExpression="STATE">
                <EditItemTemplate>
                    <asp:Label ID="stateDvLb" runat="server" Text='<%# Eval("STATE") %>'></asp:Label>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("STATE") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label14" runat="server" Text='<%# Bind("STATE") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowEditButton="True" />
        </Fields>
    </asp:DetailsView>
    <asp:Label ID="errLb" runat="server"></asp:Label>
<asp:ObjectDataSource ID="mGvOds" runat="server" 
    OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByNumber" 
    TypeName="ActivityTableAdapters.T_ACTIVITYTableAdapter" 
        onselecting="mGvOds_Selecting">
    <SelectParameters>
        <asp:Parameter Name="NUMBER" Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>
    <asp:ObjectDataSource ID="activityDvOds" runat="server" 
        InsertMethod="InsertQuery" OldValuesParameterFormatString="original_{0}" 
        SelectMethod="GetDataByID" 
        TypeName="ActivityTableAdapters.T_ACTIVITYTableAdapter" 
        UpdateMethod="UpdateByMember">
        <UpdateParameters>
            <asp:Parameter Name="TELEPHONE" Type="String" />
            <asp:Parameter Name="EMAIL" Type="String" />
            <asp:Parameter Name="NAME" Type="String" />
            <asp:Parameter Name="TIME" Type="DateTime" />
            <asp:Parameter Name="PLACE" Type="String" />
            <asp:Parameter Name="SIGNIFICANCE" Type="String" />
            <asp:Parameter Name="CONTENT" Type="String" />
            <asp:Parameter Name="ATTACHFILE" Type="String" />
            <asp:Parameter Name="GOAL" Type="String" />
            <asp:Parameter Name="BUDGET" Type="Decimal" />
            <asp:Parameter Name="original_ID" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="mainGv" Name="Original_ID" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="BRANCH_ID" Type="Int32" />
            <asp:Parameter Name="PRINCIPLE" Type="String" />
            <asp:Parameter Name="TELEPHONE" Type="String" />
            <asp:Parameter Name="EMAIL" Type="String" />
            <asp:Parameter Name="TIME" Type="DateTime" />
            <asp:Parameter Name="NAME" Type="String" />
            <asp:Parameter Name="PLACE" Type="String" />
            <asp:Parameter Name="SIGNIFICANCE" Type="String" />
            <asp:Parameter Name="CONTENT" Type="String" />
            <asp:Parameter Name="ATTACHFILE" Type="String" />
            <asp:Parameter Name="GOAL" Type="String" />
            <asp:Parameter Name="BUDGET" Type="Decimal" />
        </InsertParameters>
    </asp:ObjectDataSource>
    </asp:Content>
